/*LICENSE_BEGIN
 * ******************************************************************
 * Copyright 2006 by the Dainamite Robocup-Team at the
 * DAI-Labor, TU-Berlin (www.dai-labor.de)
 * 
 * Members of Dainamite are:
 * Holger Endert
 * Robert Wetzker
 * Thomas Karbe
 * Axel Heßler
 * Philippe Bütter
 * Felix Brossmann
 * 
 * Licensed under the GNU GPL (General Public License) Free Software 
 * License, Version 2. You may use this file only in compliance with 
 * the License. You may obtain a copy of the License at:
 * 
 * http://www.fsf.org/licensing/licenses/gpl.txt
 * ******************************************************************
LICENSE_END*/
/* Generated By:JavaCC: Do not edit this line. SeeParser.java */
                         // Robocup Message Parser
package robocup.parser9;

import robocup.component.ControllerNumbers;

import robocup.component.infotypes.VisualInfo;
import robocup.component.infotypes.PlayerInfo;
import robocup.component.infotypes.Info;
import robocup.component.RobocupAgent;
import java.io.StringReader;

/**
 * The Parser for See-Infos. This class is created by the
 * javacc parser generator. Therefore do not change this class directly,
 * but change the SeeParser.jj and regenerate the code afterwards.
 */
public class SeeParser implements SeeParserConstants {

        /**
	 * The visual info object. This is returned after parsing.
	 * Note, that this is reused for performance reasons. 
	 */
        VisualInfo vi = new VisualInfo(0);

        int value = 0;

        /**
	 * A reference to the robocup-agent, which contains this parser.
	 */
        RobocupAgent rc;

        /**
	 * Creates a new instance of the parser.
	 * @param - StringReader - reader for accessing strings
	 * @param - RobocupAgent - the agent object containing this parser
	 */
        public SeeParser(StringReader str, RobocupAgent rc) {
                this(str);
                this.rc = rc;
        }

    public Info parseSee(String cmd)
        throws ParseException{
      ReInit(new StringReader(cmd));

          vi.reset();

      try {
        startSeeCommand();
      } catch (ParseException e) {
        System.out.println("Exception during Parsing with Command:");
        System.out.println("  " + cmd +"\r\n"+ e);
      } catch (Error e) {
        System.out.println("Error during Parsing with Command:");
        System.out.println("  " + cmd +"\r\n"+ e);
      }
      return vi;
    }

  final public void startSeeCommand() throws ParseException {
        Token cycle=null; int iCycle;
    cycle = jj_consume_token(NUM);
              iCycle=Integer.parseInt(cycle.image);vi.setCycle(iCycle);
    switch (jj_nt.kind) {
    case SEP:
      jj_consume_token(SEP);
      label_1:
      while (true) {
        jj_consume_token(OB);
        objInfo(iCycle);
        jj_consume_token(CB);
        switch (jj_nt.kind) {
        case SEP:
          jj_consume_token(SEP);
          break;
        default:
          jj_la1[0] = jj_gen;
          ;
        }
        switch (jj_nt.kind) {
        case OB:
          ;
          break;
        default:
          jj_la1[1] = jj_gen;
          break label_1;
        }
      }
      break;
    default:
      jj_la1[2] = jj_gen;
      ;
    }
  }

  final public void flagInfo(int cycle) throws ParseException {
        int id=-1; Token dir; Token dist=null; Token temp=null;
        double dDist = -999.99; double dDir;
    jj_consume_token(F);
    switch (jj_nt.kind) {
    case SEP:
      id = getFlagId();
      break;
    default:
      jj_la1[3] = jj_gen;
      ;
    }
    jj_consume_token(CB);
    jj_consume_token(SEP);
    dir = jj_consume_token(NUM);
    switch (jj_nt.kind) {
    case SEP:
      jj_consume_token(SEP);
      temp = jj_consume_token(NUM);
                           dist=dir;dir=temp;
      switch (jj_nt.kind) {
      case SEP:
        jj_consume_token(SEP);
        jj_consume_token(NUM);
        jj_consume_token(SEP);
        jj_consume_token(NUM);
        break;
      default:
        jj_la1[4] = jj_gen;
        ;
      }
      break;
    default:
      jj_la1[5] = jj_gen;
      ;
    }
                dDir = Double.parseDouble(dir.image);
                if(dist != null)
                        dDist = Double.parseDouble(dist.image);
                if(id!=-1)
                        vi.addFlag(cycle,id, dDist, dDir);
  }

  final public void lineInfo(int cycle) throws ParseException {
        int id=-1; Token dir; Token dist=null; Token temp=null;
        double dDist = -999.99; double dDir;
    jj_consume_token(L);
    switch (jj_nt.kind) {
    case SEP:
      id = getLineId();
      break;
    default:
      jj_la1[6] = jj_gen;
      ;
    }
    jj_consume_token(CB);
    jj_consume_token(SEP);
    dir = jj_consume_token(NUM);
    switch (jj_nt.kind) {
    case SEP:
      jj_consume_token(SEP);
      temp = jj_consume_token(NUM);
                           dist=dir;dir=temp;
      switch (jj_nt.kind) {
      case SEP:
        jj_consume_token(SEP);
        jj_consume_token(NUM);
        jj_consume_token(SEP);
        jj_consume_token(NUM);
        break;
      default:
        jj_la1[7] = jj_gen;
        ;
      }
      break;
    default:
      jj_la1[8] = jj_gen;
      ;
    }
                dDir = Double.parseDouble(dir.image);
                if(dist != null)
                        dDist = Double.parseDouble(dist.image);
                if(id!=-1)
                        vi.addLine(cycle,id, dDist, dDir);
  }

  final public void ballInfo(int cycle) throws ParseException {
        Token dir; Token dist=null; Token temp=null;
        double dDist = -999.99; double dDir;
        Token distChange = null; Token dirChange = null;
        double dDistChange = -999.99; double dDirChange = -999.99;
    jj_consume_token(B);
    jj_consume_token(CB);
    jj_consume_token(SEP);
    dir = jj_consume_token(NUM);
    switch (jj_nt.kind) {
    case SEP:
      jj_consume_token(SEP);
      temp = jj_consume_token(NUM);
                           dist=dir;dir=temp;
      switch (jj_nt.kind) {
      case SEP:
        jj_consume_token(SEP);
        distChange = jj_consume_token(NUM);
        jj_consume_token(SEP);
        dirChange = jj_consume_token(NUM);
        break;
      default:
        jj_la1[9] = jj_gen;
        ;
      }
      break;
    default:
      jj_la1[10] = jj_gen;
      ;
    }
                dDir = Double.parseDouble(dir.image);
                if(dist != null)
                        dDist = Double.parseDouble(dist.image);
                if(distChange != null)
                        dDistChange = Double.parseDouble(distChange.image);
                if(dirChange!=null)
                        dDirChange = Double.parseDouble(dirChange.image);
                vi.setBall(cycle, dDist, dDir, dDistChange, dDirChange);
  }

  final public void unknownBallInfo(int cycle) throws ParseException {
        Token dir; Token dist=null; double dDist = 1.5; Token tmp;
    jj_consume_token(B_U);
    jj_consume_token(CB);
    jj_consume_token(SEP);
    dir = jj_consume_token(NUM);
    switch (jj_nt.kind) {
    case SEP:
      jj_consume_token(SEP);
      tmp = jj_consume_token(NUM);
                        dist=dir;
                        dir=tmp;
                        dDist=Double.parseDouble(dist.image);
      break;
    default:
      jj_la1[11] = jj_gen;
      ;
    }
                vi.setBall(cycle, dDist, Double.parseDouble(dir.image), -999.99, -999.99);
  }

  final public void playerInfo(int cycle) throws ParseException {
        Token dir; Token dist=null; Token temp=null;
        double dDist = -999.99; double dDir;
        Token distChange = null; Token dirChange = null;
        double dDistChange = -999.99; double dDirChange = -999.99;
        Token bodyFacingDir=null;       Token headFacingDir=null;
        double dBodyFacingDir=-999.99; double dHeadFacingDir=-999.99;
        Token pointDir=null; boolean tackle=false;
        double dPointDir=-999.99;
        Token teamName=null; String sTeamName = new String();
        boolean goalie=false;
        Token num=null;int iNum = -1;
    jj_consume_token(P);
    switch (jj_nt.kind) {
    case SEP:
      jj_consume_token(SEP);
      jj_consume_token(QM);
      switch (jj_nt.kind) {
      case NAM:
        teamName = jj_consume_token(NAM);
                                sTeamName=teamName.image;
        break;
      default:
        jj_la1[12] = jj_gen;
        ;
      }
      jj_consume_token(QM);
      switch (jj_nt.kind) {
      case SEP:
        jj_consume_token(SEP);
        num = jj_consume_token(NUM);
        switch (jj_nt.kind) {
        case SEP:
          jj_consume_token(SEP);
          jj_consume_token(GOALIE);
                                              goalie=true;
          break;
        default:
          jj_la1[13] = jj_gen;
          ;
        }
                                                             iNum = Integer.parseInt(num.image);
        break;
      default:
        jj_la1[14] = jj_gen;
        ;
      }
      break;
    default:
      jj_la1[15] = jj_gen;
      ;
    }
    jj_consume_token(CB);
    jj_consume_token(SEP);
    dir = jj_consume_token(NUM);
                  dDir = Double.parseDouble(dir.image);
    switch (jj_nt.kind) {
    case SEP:
      jj_consume_token(SEP);
      break;
    default:
      jj_la1[16] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case NUM:
      temp = jj_consume_token(NUM);
                        dDir = Double.parseDouble(temp.image);
                        dDist = Double.parseDouble(dir.image);
      switch (jj_nt.kind) {
      case SEP:
        jj_consume_token(SEP);
        break;
      default:
        jj_la1[17] = jj_gen;
        ;
      }
      switch (jj_nt.kind) {
      case NUM:
        pointDir = jj_consume_token(NUM);
        switch (jj_nt.kind) {
        case SEP:
          jj_consume_token(SEP);
          break;
        default:
          jj_la1[18] = jj_gen;
          ;
        }
        switch (jj_nt.kind) {
        case NUM:
          dirChange = jj_consume_token(NUM);
                                                distChange=pointDir;pointDir=null;
          switch (jj_nt.kind) {
          case SEP:
            jj_consume_token(SEP);
            break;
          default:
            jj_la1[19] = jj_gen;
            ;
          }
          switch (jj_nt.kind) {
          case NUM:
            pointDir = jj_consume_token(NUM);
            switch (jj_nt.kind) {
            case SEP:
              jj_consume_token(SEP);
              break;
            default:
              jj_la1[20] = jj_gen;
              ;
            }
            switch (jj_nt.kind) {
            case NUM:
              headFacingDir = jj_consume_token(NUM);
                                                                    bodyFacingDir=pointDir;pointDir=null;
              switch (jj_nt.kind) {
              case SEP:
                jj_consume_token(SEP);
                break;
              default:
                jj_la1[21] = jj_gen;
                ;
              }
              switch (jj_nt.kind) {
              case NUM:
                pointDir = jj_consume_token(NUM);
                switch (jj_nt.kind) {
                case SEP:
                  jj_consume_token(SEP);
                  break;
                default:
                  jj_la1[22] = jj_gen;
                  ;
                }
                break;
              default:
                jj_la1[23] = jj_gen;
                ;
              }
              break;
            default:
              jj_la1[24] = jj_gen;
              ;
            }
            break;
          default:
            jj_la1[25] = jj_gen;
            ;
          }
          break;
        default:
          jj_la1[26] = jj_gen;
          ;
        }
        break;
      default:
        jj_la1[27] = jj_gen;
        ;
      }
      break;
    default:
      jj_la1[28] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case T:
      jj_consume_token(T);
                    tackle=true;
      break;
    default:
      jj_la1[29] = jj_gen;
      ;
    }
                if(pointDir!=null)
                        dPointDir = Double.parseDouble(pointDir.image);
                if(distChange!=null)
                        dDistChange = Double.parseDouble(distChange.image);
                if(dirChange!=null)
                        dDirChange = Double.parseDouble(dirChange.image);
                if(bodyFacingDir!=null)
                        dBodyFacingDir = Double.parseDouble(bodyFacingDir.image);
                if(headFacingDir!=null)
                        dHeadFacingDir = Double.parseDouble(headFacingDir.image);
                if(sTeamName.equals(rc.getTeamName())) {
                        // System.out.println(sTeamName + " = " + rc.getTeamName());
                        vi.addPlayer(cycle,PlayerInfo.FRIEND,iNum, dDist, dDir, dDistChange, dDirChange, dBodyFacingDir, dHeadFacingDir, dPointDir, tackle, goalie, teamName.image);
                } else {
                        // System.out.println(sTeamName + " = " + rc.getTeamName());
                        if(teamName!=null) {
                                vi.addPlayer(cycle,PlayerInfo.OPPONENT,iNum, dDist, dDir, dDistChange, dDirChange, dBodyFacingDir, dHeadFacingDir, dPointDir, tackle, goalie, teamName.image);
                        }
                        else
                                vi.addPlayer(cycle,PlayerInfo.UNKNOWN,iNum, dDist, dDir, dDistChange, dDirChange, dBodyFacingDir, dHeadFacingDir, dPointDir, tackle, goalie, "unknownTeam");
                }
  }

  final public void unknownPlayerInfo(int cycle) throws ParseException {
        Token dir; Token dist=null; Token tmp; double dDist=1.5;
    jj_consume_token(P_U);
    jj_consume_token(CB);
    jj_consume_token(SEP);
    dir = jj_consume_token(NUM);
    switch (jj_nt.kind) {
    case SEP:
      jj_consume_token(SEP);
      tmp = jj_consume_token(NUM);
                        dist=dir;
                        dir=tmp;
                        dDist=Double.parseDouble(dist.image);
      break;
    default:
      jj_la1[30] = jj_gen;
      ;
    }
                vi.addPlayer(cycle,PlayerInfo.UNKNOWN,-1, dDist, Double.parseDouble(dir.image), -999.99, -999.99, -999.99, -999.99, -999.99, false, false, "unknownTeam");
  }

  final public void goalInfo(int cycle) throws ParseException {
        int id = -1; Token dir; Token dist=null; double dDist = -999.99;
        Token distChange = null; Token dirChange = null; Token tmp;
        double dDistChange = -999.99; double dDirChange = -999.99;
    jj_consume_token(G);
    switch (jj_nt.kind) {
    case SEP:
      jj_consume_token(SEP);
      switch (jj_nt.kind) {
      case L:
        jj_consume_token(L);
                                                                if(rc.isTeamEast()){id=640;}
                                                                else{id=630;}
        break;
      case R:
        jj_consume_token(R);
                                                                if(rc.isTeamEast()){id=630;}
                                                                else{id=640;}
        break;
      default:
        jj_la1[31] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[32] = jj_gen;
      ;
    }
    jj_consume_token(CB);
    jj_consume_token(SEP);
    dir = jj_consume_token(NUM);
    switch (jj_nt.kind) {
    case SEP:
      jj_consume_token(SEP);
      tmp = jj_consume_token(NUM);
                        dist=dir;
                        dir=tmp;
      switch (jj_nt.kind) {
      case SEP:
        jj_consume_token(SEP);
        distChange = jj_consume_token(NUM);
        jj_consume_token(SEP);
        dirChange = jj_consume_token(NUM);
        break;
      default:
        jj_la1[33] = jj_gen;
        ;
      }
      break;
    default:
      jj_la1[34] = jj_gen;
      ;
    }
                if (dist!=null)
                        dDist = Double.parseDouble(dist.image);
                if(distChange != null)
                        dDistChange = Double.parseDouble(distChange.image);
                if(dirChange!=null)
                        dDirChange = Double.parseDouble(dirChange.image);
                if(id!=-1)
                        vi.addFlag(cycle,id, dDist, Double.parseDouble(dir.image));
  }

  final public void objInfo(int cycle) throws ParseException {
    jj_consume_token(OB);
    switch (jj_nt.kind) {
    case F:
      flagInfo(cycle);
      break;
    case G:
      goalInfo(cycle);
      break;
    case L:
      lineInfo(cycle);
      break;
    case P:
      playerInfo(cycle);
      break;
    case P_U:
      unknownPlayerInfo(cycle);
      break;
    case B:
      ballInfo(cycle);
      break;
    case B_U:
      unknownBallInfo(cycle);
      break;
    default:
      jj_la1[35] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

  final public int dgetFlagId() throws ParseException {
        int flag_pos=-1; int flag_id=0;
        int TOPID     = 1;
        int BOTTOMID  = 2;
        int LEFTID    = 3;
        int RIGHTID   = 4;
        int CENTERID  = 5;
        int GOALID    = 6;
        int PENALTYID = 7;
        Token num=null; int iNum=0;
        Token a=null; Token b=null; Token c=null;
    jj_consume_token(SEP);
    switch (jj_nt.kind) {
    case CENTER:
      a = jj_consume_token(CENTER);
                                                 flag_id=CENTERID;
      break;
    case L:
      a = jj_consume_token(L);
                                                         flag_id=LEFTID;
      break;
    case R:
      a = jj_consume_token(R);
                                                         flag_id=RIGHTID;
      break;
    case T:
      a = jj_consume_token(T);
                                                         flag_id=TOPID;
      break;
    case B:
      a = jj_consume_token(B);
                                                         flag_id=BOTTOMID;
      break;
    case P:
      a = jj_consume_token(P);
                                                         flag_id=PENALTYID;
      break;
    case G:
      a = jj_consume_token(G);
                                                         flag_id=GOALID;
      break;
    default:
      jj_la1[36] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    switch (jj_nt.kind) {
    case SEP:
      jj_consume_token(SEP);
      switch (jj_nt.kind) {
      case CENTER:
        b = jj_consume_token(CENTER);
                                                         flag_id*=10;flag_id+=CENTERID;
        break;
      case L:
        b = jj_consume_token(L);
                                                                 flag_id*=10;flag_id+=LEFTID;
        break;
      case R:
        b = jj_consume_token(R);
                                                                 flag_id*=10;flag_id+=RIGHTID;
        break;
      case T:
        b = jj_consume_token(T);
                                                                 flag_id*=10;flag_id+=TOPID;
        break;
      case B:
        b = jj_consume_token(B);
                                                                 flag_id*=10;flag_id+=BOTTOMID;
        break;
      case NUM:
        num = jj_consume_token(NUM);
                                                         iNum=Integer.parseInt(num.image);if(iNum!=0){flag_pos=iNum;}else{flag_id*=10;}
        break;
      default:
        jj_la1[37] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      switch (jj_nt.kind) {
      case SEP:
        jj_consume_token(SEP);
        switch (jj_nt.kind) {
        case CENTER:
          c = jj_consume_token(CENTER);
                                                                 flag_id*=10;flag_id+=CENTERID;
          break;
        case L:
          c = jj_consume_token(L);
                                                                         flag_id*=10;flag_id+=LEFTID;
          break;
        case R:
          c = jj_consume_token(R);
                                                                         flag_id*=10;flag_id+=RIGHTID;
          break;
        case T:
          c = jj_consume_token(T);
                                                                         flag_id*=10;flag_id+=TOPID;
          break;
        case B:
          c = jj_consume_token(B);
                                                                         flag_id*=10;flag_id+=BOTTOMID;
          break;
        case NUM:
          num = jj_consume_token(NUM);
                                                                 iNum=Integer.parseInt(num.image);if(iNum!=0){flag_pos=iNum;}else{flag_id*=10;}
          break;
        default:
          jj_la1[38] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
        break;
      default:
        jj_la1[39] = jj_gen;
        ;
      }
      break;
    default:
      jj_la1[40] = jj_gen;
      ;
    }
                //spielen wir auf der rechten Seite, vertauschen sich links und recht, oben und unten
                if(rc.isTeamEast())
                {
                int res_flag_id = 0;
            if(flag_id % 10 == TOPID) res_flag_id = BOTTOMID;
                  if(flag_id % 10 == BOTTOMID) res_flag_id = TOPID;
                  if(flag_id % 10 == LEFTID) res_flag_id = RIGHTID;
                  if(flag_id % 10 == RIGHTID) res_flag_id = LEFTID;
                  if(flag_id % 10 == CENTERID) res_flag_id = CENTERID;

                  if(flag_id/10 % 10 == TOPID) res_flag_id += BOTTOMID *10;
                  if(flag_id/10 % 10 == BOTTOMID) res_flag_id += TOPID *10;
                  if(flag_id/10 % 10 == LEFTID) res_flag_id += RIGHTID *10;
                  if(flag_id/10 % 10 == RIGHTID) res_flag_id += LEFTID *10;
                  if(flag_id/10 % 10 == CENTERID) res_flag_id += CENTERID *10;

                  res_flag_id += (flag_id /100) * 100;
                  flag_id=res_flag_id;
          }

          //f�r die Zahlen 10,20...,50 wird die erste Stelle der Id genutzt (Zahl/10)
          if (flag_pos !=-1)
          {
                flag_id += 10* flag_pos;
          }
          {if (true) return flag_id;}
    throw new Error("Missing return statement in function");
  }

  final public int getFlagId() throws ParseException {
        int flag_pos=-1; int flag_id=0;
        int TOPID     = 1;
        int BOTTOMID  = 2;
        int LEFTID    = 3;
        int RIGHTID   = 4;
        int CENTERID  = 5;
        int GOALID    = 6;
        int PENALTYID = 7;
        Token num=null; int iNum=0;
    jj_consume_token(SEP);
    switch (jj_nt.kind) {
    case CENTER:
      jj_consume_token(CENTER);
                                                 flag_id=CENTERID;
      break;
    case L:
      jj_consume_token(L);
                                                         flag_id=LEFTID;
      break;
    case R:
      jj_consume_token(R);
                                                         flag_id=RIGHTID;
      break;
    case T:
      jj_consume_token(T);
                                                         flag_id=TOPID;
      break;
    case B:
      jj_consume_token(B);
                                                         flag_id=BOTTOMID;
      break;
    case P:
      jj_consume_token(P);
                                                         flag_id=PENALTYID;
      break;
    case G:
      jj_consume_token(G);
                                                         flag_id=GOALID;
      break;
    default:
      jj_la1[41] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    switch (jj_nt.kind) {
    case SEP:
      label_2:
      while (true) {
        jj_consume_token(SEP);
        switch (jj_nt.kind) {
        case CENTER:
          jj_consume_token(CENTER);
                                                         flag_id*=10;flag_id+=CENTERID;
          break;
        case L:
          jj_consume_token(L);
                                                                 flag_id*=10;flag_id+=LEFTID;
          break;
        case R:
          jj_consume_token(R);
                                                                 flag_id*=10;flag_id+=RIGHTID;
          break;
        case T:
          jj_consume_token(T);
                                                                 flag_id*=10;flag_id+=TOPID;
          break;
        case B:
          jj_consume_token(B);
                                         flag_id*=10;flag_id+=BOTTOMID;
          break;
        case NUM:
          num = jj_consume_token(NUM);
                                                 iNum=Integer.parseInt(num.image);if(iNum!=0){flag_pos=iNum;}else{flag_id*=10;}
          break;
        default:
          jj_la1[42] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
        switch (jj_nt.kind) {
        case SEP:
          ;
          break;
        default:
          jj_la1[43] = jj_gen;
          break label_2;
        }
      }
      break;
    default:
      jj_la1[44] = jj_gen;
      ;
    }
                //spielen wir auf der rechten Seite, vertauschen sich links und recht, oben und unten
                if(rc.isTeamEast())
                {
                int res_flag_id = 0;
            if(flag_id % 10 == TOPID) res_flag_id = BOTTOMID;
                  if(flag_id % 10 == BOTTOMID) res_flag_id = TOPID;
                  if(flag_id % 10 == LEFTID) res_flag_id = RIGHTID;
                  if(flag_id % 10 == RIGHTID) res_flag_id = LEFTID;
                  if(flag_id % 10 == CENTERID) res_flag_id = CENTERID;

                  if(flag_id/10 % 10 == TOPID) res_flag_id += BOTTOMID *10;
                  if(flag_id/10 % 10 == BOTTOMID) res_flag_id += TOPID *10;
                  if(flag_id/10 % 10 == LEFTID) res_flag_id += RIGHTID *10;
                  if(flag_id/10 % 10 == RIGHTID) res_flag_id += LEFTID *10;
                  if(flag_id/10 % 10 == CENTERID) res_flag_id += CENTERID *10;

                  res_flag_id += (flag_id /100) * 100;
                  flag_id=res_flag_id;
          }

          //f�r die Zahlen 10,20...,50 wird die erste Stelle der Id genutzt (Zahl/10)
          if (flag_pos !=-1)
          {
                flag_id += 10* flag_pos;
          }
          {if (true) return flag_id;}
    throw new Error("Missing return statement in function");
  }

  final public int getLineId() throws ParseException {
    jj_consume_token(SEP);
    switch (jj_nt.kind) {
    case L:
      jj_consume_token(L);
                                     if(rc.isTeamEast()){{if (true) return ControllerNumbers.LINE_TOP;}}else{{if (true) return ControllerNumbers.LINE_BOTTOM;}}
      break;
    case R:
      jj_consume_token(R);
                                     if(!rc.isTeamEast()){{if (true) return ControllerNumbers.LINE_TOP;}}else{{if (true) return ControllerNumbers.LINE_BOTTOM;}}
      break;
    case T:
      jj_consume_token(T);
                                     if(rc.isTeamEast()){{if (true) return ControllerNumbers.LINE_RIGHT;}}else{{if (true) return ControllerNumbers.LINE_LEFT;}}
      break;
    case B:
      jj_consume_token(B);
                                     if(!rc.isTeamEast()){{if (true) return ControllerNumbers.LINE_RIGHT;}}else{{if (true) return ControllerNumbers.LINE_LEFT;}}
      break;
    default:
      jj_la1[45] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  public SeeParserTokenManager token_source;
  SimpleCharStream jj_input_stream;
  public Token token, jj_nt;
  private int jj_gen;
  final private int[] jj_la1 = new int[46];
  static private int[] jj_la1_0;
  static {
      jj_la1_0();
   }
   private static void jj_la1_0() {
      jj_la1_0 = new int[] {0x20000,0x8000,0x20000,0x20000,0x20000,0x20000,0x20000,0x20000,0x20000,0x20000,0x20000,0x20000,0x200000,0x20000,0x20000,0x20000,0x20000,0x20000,0x20000,0x20000,0x20000,0x20000,0x20000,0x80000,0x80000,0x80000,0x80000,0x80000,0x80000,0x1000,0x20000,0x4400,0x20000,0x20000,0x20000,0xfe0,0x7d20,0x87420,0x87420,0x20000,0x20000,0x7d20,0x87420,0x20000,0x20000,0x5420,};
   }

  public SeeParser(java.io.InputStream stream) {
     this(stream, null);
  }
  public SeeParser(java.io.InputStream stream, String encoding) {
    try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
    token_source = new SeeParserTokenManager(jj_input_stream);
    token = new Token();
    token.next = jj_nt = token_source.getNextToken();
    jj_gen = 0;
    for (int i = 0; i < 46; i++) jj_la1[i] = -1;
  }

  public void ReInit(java.io.InputStream stream) {
     ReInit(stream);
  }
  public void ReInit(java.io.InputStream stream, String encoding) {
    try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
    token_source.ReInit(jj_input_stream);
    token = new Token();
    token.next = jj_nt = token_source.getNextToken();
    jj_gen = 0;
    for (int i = 0; i < 46; i++) jj_la1[i] = -1;
  }

  public SeeParser(java.io.Reader stream) {
    jj_input_stream = new SimpleCharStream(stream, 1, 1);
    token_source = new SeeParserTokenManager(jj_input_stream);
    token = new Token();
    token.next = jj_nt = token_source.getNextToken();
    jj_gen = 0;
    for (int i = 0; i < 46; i++) jj_la1[i] = -1;
  }

  public void ReInit(java.io.Reader stream) {
    jj_input_stream.ReInit(stream, 1, 1);
    token_source.ReInit(jj_input_stream);
    token = new Token();
    token.next = jj_nt = token_source.getNextToken();
    jj_gen = 0;
    for (int i = 0; i < 46; i++) jj_la1[i] = -1;
  }

  public SeeParser(SeeParserTokenManager tm) {
    token_source = tm;
    token = new Token();
    token.next = jj_nt = token_source.getNextToken();
    jj_gen = 0;
    for (int i = 0; i < 46; i++) jj_la1[i] = -1;
  }

  public void ReInit(SeeParserTokenManager tm) {
    token_source = tm;
    token = new Token();
    token.next = jj_nt = token_source.getNextToken();
    jj_gen = 0;
    for (int i = 0; i < 46; i++) jj_la1[i] = -1;
  }

  final private Token jj_consume_token(int kind) throws ParseException {
    Token oldToken = token;
    if ((token = jj_nt).next != null) jj_nt = jj_nt.next;
    else jj_nt = jj_nt.next = token_source.getNextToken();
    if (token.kind == kind) {
      jj_gen++;
      return token;
    }
    jj_nt = token;
    token = oldToken;
    jj_kind = kind;
    throw generateParseException();
  }

  final public Token getNextToken() {
    if ((token = jj_nt).next != null) jj_nt = jj_nt.next;
    else jj_nt = jj_nt.next = token_source.getNextToken();
    jj_gen++;
    return token;
  }

  final public Token getToken(int index) {
    Token t = token;
    for (int i = 0; i < index; i++) {
      if (t.next != null) t = t.next;
      else t = t.next = token_source.getNextToken();
    }
    return t;
  }

  private java.util.Vector jj_expentries = new java.util.Vector();
  private int[] jj_expentry;
  private int jj_kind = -1;

  public ParseException generateParseException() {
    jj_expentries.removeAllElements();
    boolean[] la1tokens = new boolean[22];
    for (int i = 0; i < 22; i++) {
      la1tokens[i] = false;
    }
    if (jj_kind >= 0) {
      la1tokens[jj_kind] = true;
      jj_kind = -1;
    }
    for (int i = 0; i < 46; i++) {
      if (jj_la1[i] == jj_gen) {
        for (int j = 0; j < 32; j++) {
          if ((jj_la1_0[i] & (1<<j)) != 0) {
            la1tokens[j] = true;
          }
        }
      }
    }
    for (int i = 0; i < 22; i++) {
      if (la1tokens[i]) {
        jj_expentry = new int[1];
        jj_expentry[0] = i;
        jj_expentries.addElement(jj_expentry);
      }
    }
    int[][] exptokseq = new int[jj_expentries.size()][];
    for (int i = 0; i < jj_expentries.size(); i++) {
      exptokseq[i] = (int[])jj_expentries.elementAt(i);
    }
    return new ParseException(token, exptokseq, tokenImage);
  }

  final public void enable_tracing() {
  }

  final public void disable_tracing() {
  }

}
